package com.javaGather.demo3;


import java.util.HashSet;
import java.util.LinkedHashMap;

public class LinkedHashSetDemo<E> {

    /**
     * LinkedHashSet底层基于LinkedHashMap
     */

    private LinkedHashMap<E, Object> linkedHashMap;

    public static Object PRESENT = new Object();

    public LinkedHashSetDemo() {
        linkedHashMap = new LinkedHashMap<E, Object>();

    }

    public void add(E e) {
        linkedHashMap.put(e, PRESENT);
    }

    @Override
    public String toString() {
        return "LinkedHashSetDemo{" +
                "linkedHashMap=" + linkedHashMap +
                '}';
    }
}
